UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0BIsRP05k1YSkdYDcS/VDQZHn1OwfKXtDE2HdeCIhHc=' 
WHERE 
  key_id = '8c2a3e9fcdf13f5908942350350a7a8cccd0b202399bd6156e1e76ca9b8d8997' 
  AND (
    token = '0BIsRP05k1YSkdYDcS/VDQZHn1OwfKXtDE2HdeCIhHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024