UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FR9W3OGhP4JnElOeUbE07SVMipNMT4NFmUafnPItGx4=' 
WHERE 
  key_id = '8136f19e883977e744eca258f4b4013b17835134e3c9b0c6b22979c05f227bea' 
  AND (
    token = 'FR9W3OGhP4JnElOeUbE07SVMipNMT4NFmUafnPItGx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066