UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AnFIMR80j5PBF0czdouwOEJtUGzboOY9gviJ9H+JU9I=' 
WHERE 
  key_id = '4de05e0a6d0605a432216657af583a85a4bef96a642c51390f6e26af75752d59' 
  AND (
    token = 'AnFIMR80j5PBF0czdouwOEJtUGzboOY9gviJ9H+JU9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034