UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BpjVSGu7e4BjwCKp7r0O/tdbDjvDdUj2NVuhkLRHYwc=' 
WHERE 
  key_id = 'fce5607129f0b4ed949f9e04d40a980bb53cfa64707b72beb33bfd1a41f2c151' 
  AND (
    token = 'BpjVSGu7e4BjwCKp7r0O/tdbDjvDdUj2NVuhkLRHYwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021