UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEBTpHz8/AP9hbleb31O+ivEEenYH/LdV3C7gxrB8Zo=' 
WHERE 
  key_id = '4743bdd1b1aa7310b2e7412572b0ee3f95296c7607a6af20c90b8a98255eb3b9' 
  AND (
    token = 'wEBTpHz8/AP9hbleb31O+ivEEenYH/LdV3C7gxrB8Zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031