UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wldkmWUV/1NqZ4nBOVIOqr4UlyefD/6AwJKQ4QILamk=' 
WHERE 
  key_id = 'b4c9128ae0147649ace42d75d896adcae45ba2f645e513f516bc74758b71e73f' 
  AND (
    token = 'wldkmWUV/1NqZ4nBOVIOqr4UlyefD/6AwJKQ4QILamk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035