UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zqyFudA3MwUmzVFke7rCIu2t8Nlfbn9L5TLRxqs+yyI=' 
WHERE 
  key_id = '46ec098720d204822e6ca817532560501bd666e514bc3d925210cf87753a2054' 
  AND (
    token = 'zqyFudA3MwUmzVFke7rCIu2t8Nlfbn9L5TLRxqs+yyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041