UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GcUUxoAASGF/T/BRq13QB4AH231kBGSZ9Sk/giVZVqo=' 
WHERE 
  key_id = '977b4b49c6c36bb2f753fc2ec516c093eb7af3ceda055493219c02ef363faa0d' 
  AND (
    token = 'GcUUxoAASGF/T/BRq13QB4AH231kBGSZ9Sk/giVZVqo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046