UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1V2hLtK4iZ1vCaqtEp6LY+o0ZkzMJvxcaYkzFDlCZXQ=' 
WHERE 
  key_id = 'e9c46414a7e4c3219182132506a84e63731cfc1283e0f12906d3cff4ad5d852b' 
  AND (
    token = '1V2hLtK4iZ1vCaqtEp6LY+o0ZkzMJvxcaYkzFDlCZXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046