UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sOpOjMexQzOoRCQwagpp4khvvpmXrlw1WsERqDBoA88=' 
WHERE 
  key_id = 'dbfd01e6600d3e3f06a5a14e664e8613ebfc6842e4bd9974836586411cde599c' 
  AND (
    token = 'sOpOjMexQzOoRCQwagpp4khvvpmXrlw1WsERqDBoA88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027