UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cVYNwGtL6iJGrAE15A954mMCn1OwV1rkuOMl+e40xGw=' 
WHERE 
  key_id = '8108d5bd3f87cecc259acf580419e4a298b4923cf6808d74797740a5e621da27' 
  AND (
    token = 'cVYNwGtL6iJGrAE15A954mMCn1OwV1rkuOMl+e40xGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036