UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ac8S/xQP5HLW4hhB+M1BPMgVz8DifVMEzEP1sfbXYBE=' 
WHERE 
  key_id = '133992d961678dba36af63a868a10058242f50435e4539b8cb9a99fb7fddaf42' 
  AND (
    token = 'Ac8S/xQP5HLW4hhB+M1BPMgVz8DifVMEzEP1sfbXYBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053