UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wpkBeWzXar/MycnHEx0hFYnErIBVMcqQTk9on87LuHw=' 
WHERE 
  key_id = 'dfc2cb6e0abffa4b27d593db9d745d9130b1aeb4aa08f183daff1ea7baaa75d3' 
  AND (
    token = 'wpkBeWzXar/MycnHEx0hFYnErIBVMcqQTk9on87LuHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016