UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TtubIN4GypqDwS6/HSeib2bFpHSAd07UIywgiFoNLCQ=' 
WHERE 
  key_id = '39bdeb633e6b88719c649d6200144f788dd1c31d37e15dd646264c42f6b80025' 
  AND (
    token = 'TtubIN4GypqDwS6/HSeib2bFpHSAd07UIywgiFoNLCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040