UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aBbFeIKhSGtclhOJ781KmESBrvvH/xmfIIoVQzP/w44=' 
WHERE 
  key_id = 'a22c6ab5e6f1549499728fac104159ae7ddb58d92679eeb63a6b5ebdcc955324' 
  AND (
    token = 'aBbFeIKhSGtclhOJ781KmESBrvvH/xmfIIoVQzP/w44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034