UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xik/xuX1BUiEt0Vd5mX6yecBYJ9U0B5mmw/B6Y39nig=' 
WHERE 
  key_id = 'b336d746d07f9f105352688cf7a2fa7801cd47e93dce54729bf78c83361e99e0' 
  AND (
    token = 'Xik/xuX1BUiEt0Vd5mX6yecBYJ9U0B5mmw/B6Y39nig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078