UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cft981f1O7cYMOxq+X+3DfCs2k+YOO3+4c8Iip4lokY=' 
WHERE 
  key_id = '701998f4c13095655ba0221ddf8ff32c1548d7987b61dcbcfa5bbe0e09a60aa8' 
  AND (
    token = 'cft981f1O7cYMOxq+X+3DfCs2k+YOO3+4c8Iip4lokY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053