UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZZvYeRI/95gJt0NbpZSFsOJ2a+n3mrMStI75tn7VhbE=' 
WHERE 
  key_id = 'e05312e4e0f0b990cd8ed24ae344cba90643a76962d77b0dd2d381716eab2be4' 
  AND (
    token = 'ZZvYeRI/95gJt0NbpZSFsOJ2a+n3mrMStI75tn7VhbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037