UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PlfWtomY0F9UeN71r4BMm823nt3vuqzKt/h38eliKH0=' 
WHERE 
  key_id = '886037381e931d2c63b20a03089b2d1f83e227d9df7aa0288d9b44e71d74fe67' 
  AND (
    token = 'PlfWtomY0F9UeN71r4BMm823nt3vuqzKt/h38eliKH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020