UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhgpWlft4D6Xq0fcF5VCNRZv64y+LKK3MeBgwMnrd6A=' 
WHERE 
  key_id = 'e9ca9271be3aad1e3f2172c1c6df6b7cbc6230f74e43a6b86d855f5ba1ef4b3f' 
  AND (
    token = 'yhgpWlft4D6Xq0fcF5VCNRZv64y+LKK3MeBgwMnrd6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036