UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AYU4nqztgXOQ9FweCaVA06Id13HBA1sy/7naepKv2sk=' 
WHERE 
  key_id = '7695dfd8e0d65ad327ad6e45b95c0532b89732f775572c722063fb0dc9686fa8' 
  AND (
    token = 'AYU4nqztgXOQ9FweCaVA06Id13HBA1sy/7naepKv2sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023