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

Query time 0.00017