UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AWeMEX9A3BmQHy0pA2PD4P3l0Q1+A3Xw5DsnuQVV0qo=' 
WHERE 
  key_id = '5b2964875dfd1dd2da106747d038037f20e60ecbc0f25dcfec985fa969a89a11' 
  AND (
    token = 'AWeMEX9A3BmQHy0pA2PD4P3l0Q1+A3Xw5DsnuQVV0qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028