UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GlqRgtg0E1RAlC4ok79dNT7WauIytnIJ78mp05dGs6s=' 
WHERE 
  key_id = 'fba486d4ee6b78fc42cefd6893fd672aba9dd5320d01200481c90eee339c4822' 
  AND (
    token = 'GlqRgtg0E1RAlC4ok79dNT7WauIytnIJ78mp05dGs6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038