UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ekHAjk2iL3tGPs/gooBnAr0yye9DCghglqRZYzyBoQ0=' 
WHERE 
  key_id = 'c326c34c0cc9949237cbd0df00687cf3a6301270dac9007e02c5991234776be1' 
  AND (
    token = 'ekHAjk2iL3tGPs/gooBnAr0yye9DCghglqRZYzyBoQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024