UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDpYrZ8lEAbjkmQQ2tT78MsyJRQo4I3Q9irB+UVGs3k=' 
WHERE 
  key_id = 'df07e02a518fc95546d67bafb0a0072217d03f22c70aa752bfa98fdcf698b58a' 
  AND (
    token = 'ZDpYrZ8lEAbjkmQQ2tT78MsyJRQo4I3Q9irB+UVGs3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027