UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fcmrTjgJi4q2ByGmtUES02Nn+b0FAO6gE5TWQaXtU+w=' 
WHERE 
  key_id = '674e87203d0232a1f6568c6e5c5d487ce5ee70f2436451bbb68e38737c6f4bf8' 
  AND (
    token = 'fcmrTjgJi4q2ByGmtUES02Nn+b0FAO6gE5TWQaXtU+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017