UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O8hJcdum3VHP7YcQ2dTDvfddcqtQYRLL50IkI6LYe+w=' 
WHERE 
  key_id = '1e743dc2d992f89dfaf54c76e7783e5a009182200fc166ba794f5c279b122e52' 
  AND (
    token = 'O8hJcdum3VHP7YcQ2dTDvfddcqtQYRLL50IkI6LYe+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050