UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'heWYnXh9GkyVBXOr1UU+2iBshsFBqET7JGDtlnaVARA=' 
WHERE 
  key_id = 'ded9cc3c0ad8cfd393c7e677b65551a5c2bad5541e232e6cf307c88d6314a6eb' 
  AND (
    token = 'heWYnXh9GkyVBXOr1UU+2iBshsFBqET7JGDtlnaVARA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030