UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+lV182CQqFwKCkG3v/L54m2p5FsSHhFst7Z0eGxfvo=' 
WHERE 
  key_id = '3e5f611bb432aa4848a6ac64c3bb3e08c6449a6a5cfb755db7c4dbbdd16aaa39' 
  AND (
    token = 'L+lV182CQqFwKCkG3v/L54m2p5FsSHhFst7Z0eGxfvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032