UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'etHsYS9SdWtH5fIq/sq6c9EGkntGwqLQMPF1Sv6nPNs=' 
WHERE 
  key_id = '9a416d3a95984796c6d16b2c459f212355e77e38d5993658764c9f65e8e2c4fb' 
  AND (
    token = 'etHsYS9SdWtH5fIq/sq6c9EGkntGwqLQMPF1Sv6nPNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025